package com.uc503.ucoa.controller;

import com.alibaba.fastjson.JSONObject;
import com.uc503.ucoa.domain.UserInfo;
import com.uc503.ucoa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(value = "user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(value = "query-users")
    public @ResponseBody List<UserInfo> getUserInfoList(){
        List<UserInfo> userInfoList = userService.getUserList();

        return userInfoList;
    }

    @RequestMapping(value = "query-test")
    public @ResponseBody JSONObject getUserInfoTest(){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("hello","world");
        return jsonObject;
    }
}
